<#assign path = request.getContextPath()>
<#assign basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/">

<!DOCTYPE HTML>
<html>
<head>
    <title>WebDesign Student - Submithomework</title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

    <!-- bootstrap -->
    <link href="${path}/css/bootstrap/bootstrap.css" rel="stylesheet"/>
    <link href="${path}/css/bootstrap/bootstrap-responsive.css" rel="stylesheet"/>
    <link href="${path}/css/bootstrap/bootstrap-overrides.css" type="text/css" rel="stylesheet"/>

    <!-- global styles -->
    <link rel="stylesheet" type="text/css" href="${path}/css/layout.css"/>
    <link rel="stylesheet" type="text/css" href="${path}/css/elements.css"/>
    <link rel="stylesheet" type="text/css" href="${path}/css/icons.css"/>

    <!-- libraries -->
    <link href="${path}/css/lib/font-awesome.css" type="text/css" rel="stylesheet"/>

    <!-- this page specific styles -->
    <link rel="stylesheet" href="${path}/css/compiled/tables.css" type="text/css" media="screen"/>
    <link rel="stylesheet" href="${path}/css/compiled/index.css" type="text/css" media="screen"/>

    <!-- open sans font -->
    <link href='http://fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800'
          rel='stylesheet' type='text/css'/>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>

<body>
<!-- navbar -->
<div class="navbar navbar-inverse">
    <div class="navbar-inner">
        <a class="brand" href="#"><img src="${path}/img/logo-login.png"/></a><!--LOGO图片-->
        <ul class="nav pull-right">
            <li>
                    <a href="${path}/stu/homeworkState">
                    ${username}
                    </a>
            </li>
            <li>
                    <a href="${path}/common/homeworkDisplay">
                        查看展示作业　　
                      <!--  <b class="caret"></b>--><!--三角箭头-->
                    </a>
                </li>
                <div class="copyrights"></div>

                 <li class="hidden-phone">
                    <a href="${path}/stu/changePwd">
                       修改密码
                    </a>
                </li>

                <li class="hidden-phone">
                    <a href="${path}/common/logout"><!--跳转到signin.html页面-->

                       注销
                    </a>
                </li>
            </ul>            
        </div>
    </div>
<!-- end navbar -->

<div class="contentt">
    <div class="container-fluid">
        <div class="table-wrapper section">
            <div class="row-fluid">
            	<table class="table table-hover" style="font-size: 13px;border-color: #0e90d2">
                	<tr>
                    	<td style="font-weight: bold;width:20%">题目</td>
                            
                        <td style="width:80%">
                        	<p>${homework.title}</p>
                        </td>
                    </tr>
                        
                    <tr>
                    	<td style="font-weight: bold;width:20%">描述</td>
                            
                        <td style="width:80%">
                        	<p>${homework.description}</p>    	
                        </td>
                    </tr>
                        
                    <tr>
                    	<td style="font-weight: bold;width:20%">时间</td>
                            
                        <td style="width:80%">
                        	<p>开始时间：${homework.starttime?string('yyyy-MM-dd HH:mm:ss')}</p>
                            	<p>截止时间：${homework.endtime?string('yyyy-MM-dd HH:mm:ss')}</p>
                        </td>
                    </tr>
                        
                    <tr>
                    	<td style="font-weight: bold;width:20%">评分方式</td>
                            
                        <td style="width:80%">
                        	<#if homework.graded == 0>
                            	<p>默认打分</p>
                            </#if>
                            <#if homework.graded == 1>
                            	<p>主观打分</p>
                            </#if>
                        </td>
                     </tr>  
                </table>      
                <input type="file" name="upfile" id="upfile" style="margin-top:15px;float:right">
                <br />
                <input type="button" name="btn" id="btn"  onclick="ajaxFileUpload();" class="btn-glow primary" style="margin-top:30px" value="提交"/>
            </div>
        </div>
    </div>
</div>
<!-- end main container -->

<script src="${path}/js/jquery.js"></script>
<script src="${path}/js/bootstrap.min.js"></script>
<script src="${path}/js/theme.js"></script>
<script src="${path}/js/ajaxfileupload.js"></script>

<script type="text/javascript">

function ajaxFileUpload()  
{  
	 $.ajaxFileUpload  
	    (
	    		{  
			        url:'${path}/ajax/submitHomework?homeworkid=${homeworkid}',  
			        secureuri:false,  
			        fileElementId:'upfile',  
			        dataType: 'json',  
			        success: function (data,status)  
			        {  
			        	if(data.msg == "success"){
			        		alert("提交成功！"); 
			        	}
			        	if(data.msg == "fail"){
			        		alert("提交失败！"); 
			        	}
			        	else if(data.msg == "wrong"){
		
			        		alert("请上传zip或者rar文件！");
			        	}
			        },  
			        error : function(data,status,e) {
						alert(e);
					}
			    }
	    )
}  
</script>

</body>

</html>